package com.itheima.demo7;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class ClientDemo1 {
    public static void main(String[] args) throws IOException {
        //TCP协议，发送数据
        //聊天室

        //1.创建Socket对象
       Socket sc = new Socket("127.0.0.1",10086);

       //2.写出数据
        Scanner s = new Scanner(System.in);
        OutputStream os = sc.getOutputStream();

        while (true) {
            String str = s.nextLine();
            os.write(str.getBytes());
            if ("886".equals(str)){
                break;
            };
        }

        sc.close();


    }
}
